import { ajax } from '@/utils'

const baseUrl = '/yswy-zy-activity'

export default {
  /**
   * 红包雨活动创建
   */
  createRedPacketRain(data: any): Promise<any> {
    return ajax.post(`${baseUrl}/redPacket/create`, data)
  },
  /**
   * 红包雨活动详情
   */
  getRedPacketRainInfo(id: number): Promise<any> {
    return ajax.get(`${baseUrl}/redPacket/detail/${id}`)
  },
  /**
   * 红包雨活动更新
   */
  updateRedPacketRain(data: any): Promise<any> {
    return ajax.put(`${baseUrl}/redPacket/edit`, data)
  },
  /**
   * 红包雨活动列表
   */
  getRedPacketRainList(data: any): Promise<any> {
    return ajax.post(`${baseUrl}/redPacket/list`, data)
  },
  /**
   * 红包雨活动删除
   */
  deleteRedPacketRain(id: number): Promise<any> {
    return ajax.delete(`${baseUrl}/redPacket/del/${id}`)
  },
  /**
   * 红包雨活动发布、取消发布
   */
  publishRedPacketRain(id: number): Promise<any> {
    return ajax.post(`${baseUrl}/redPacket/publish/${id}`)
  },
  /**
   * 红包雨活动-结束
   */
  overRedPacketRain(id: number): Promise<any> {
    return ajax.put(`${baseUrl}/redPacket/over/${id}`)
  },
  /**
   * 红包雨-查看数据
   */
  getRedPacketRainResultData(data: any): Promise<any> {
    return ajax.post(`${baseUrl}/redPacket/view`, data)
  },
  /**
   * 红包雨-导出数据
   */
  exportRedPacketRainResultData(id: number): Promise<any> {
    return ajax.get(`${baseUrl}/redPacket/export/${id}`, {
      responseType: 'blob',
      withResponse: true
    })
  }
}
